#ifndef IMGPROCTAB_H
#define IMGPROCTAB_H

#include <QWidget>
#include <QPixmap>
#include <QIcon>
#include <QMessageBox>
#include "imageloader.h"
#include "initmeasurement.h"

#define NORTH 1
#define SOUTH 3

using namespace cv;

namespace Ui {
    class ImgProcTab;
}

class ImgProcTab : public QWidget
{
    Q_OBJECT

public:
    explicit ImgProcTab(QWidget *parent = 0);
    ~ImgProcTab();
    void addLoader(ImageLoader *imgL);
    void showContent();


private slots:
    void run(int index);
    void showStyle(int index);
    void showContour();
    void showBoundBox();
    void showSkeleton();
    void showResult();
    void original();
    void enlarge();
    void selectMethod(int index);
    void done();

private:

    void init();
    void reset(int index);
    void toGray();
    void toBin();
    void display(const Mat& img);
    void calcHistogram(const Mat& img);
    void doAnalysis(int seed, int rep, int method);

    Ui::ImgProcTab *ui;
    Mat img, bin_img, gray_img;
    Mat label_img, bound_img, contour_img, ske_img;
    Mat result_img;
    QPointer<ImageLoader> imgL;
    QPointer<InitMeasurement> initm;
    bool loaded, added;
    int pos, max_pos, fileIndex;
    int seedtype, replicate;
    Rect roi;
};

#endif // IMGPROCTAB_H
